/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package dao;

import java.sql.ResultSet;
import java.util.ArrayList;
import pojo.ChiTietDonDatHang_pojo;
import util.MySQLDataAccessHelper;

/**
 *
 * @author Rocker000
 */
public class ChiTietDonDatHang_dao 
{
    public static ArrayList<ChiTietDonDatHang_pojo> LayDanhSach()
    {
        ArrayList<ChiTietDonDatHang_pojo> ds = new ArrayList<ChiTietDonDatHang_pojo>();
        try
        {            
            String sql ="select*from dondathang";
            MySQLDataAccessHelper helper = new MySQLDataAccessHelper();
            helper.Open();
            ResultSet rs = helper.ExeCuteQuery(sql);
            while(rs.next())
            {
                ChiTietDonDatHang_pojo temp = new ChiTietDonDatHang_pojo();
                temp.setMachitietdondathang(rs.getInt("machitietdondathang"));
                temp.setMadondathang(rs.getInt("madondathang"));
                temp.setMasanpham(rs.getString("masanhpham"));
                temp.setSoluong(rs.getInt("soluong"));
                
                ds.add(temp);
            }
            helper.Close();
                
        }
        catch(Exception ex)
        {
            System.out.println(ex.getMessage());
        }
        return ds;        
    }
    
}
